package com.eva.learn.concurrent.thinkInJava;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 利用执行器Executor来管理Thread对象
 * CachedThreadPool
 * FixedThreadPool
 * SingleThreadExecutor
 * 
 * @author Evain.C
 *
 */
public class CachedThreadPool {
	public static void main(String[] args) {
		ExecutorService exec = Executors.newCachedThreadPool();
//		ExecutorService exec = Executors.newFixedThreadPool(10);
//		ExecutorService exec = Executors.newSingleThreadExecutor();
		for (int i = 0; i < 5; i++) {
			exec.execute(new LiftOff());
		}
		exec.shutdown();
	}
}
